package com.panshi.service;

import com.panshi.entity.*;
import com.panshi.service.impl.SysClientServiceFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.List;

@Service
@FeignClient(value = "hasbei-sys-provider-8008-xhlmr",fallbackFactory = SysClientServiceFallbackFactory.class)
public interface SysClientService {

    @GetMapping("/sys-admin-t/getAdminById/{id}")
    public SysAdminT getAdminById(@PathVariable int id);
    //按邮箱搜索管理员
    @GetMapping("/sys-admin-t/getAdminEmail/{email}")
    public SysAdminApi getAdminEmail(@PathVariable String email);

    //按手机号搜索管理员
    @GetMapping("/sys-admin-t/getAdminPhone/{phone}")
    public SysAdminApi getAdminPhone(@PathVariable String phone);

    @ApiOperation("删除管理员角色关系 ")
    @PostMapping("/sys-user-role-t/sysUserDelRole")
    public Boolean sysUserDelRole(@RequestBody SysUserRoleT sysUserRoleT);

    //查询全部管理员
    @GetMapping("/sys-admin-t/getAdminAll")
    public List<SysAdminApi> getAdminAll();

    @ApiOperation("按用户名查询  加分页")
    @GetMapping("/user/getUserByName/{adminname}/{status}/{page}/{limit}")
    public List<SysAdminT> getAdminLikeName(@PathVariable String adminname,@PathVariable String status,@PathVariable int page,@PathVariable int limit);

    //功能表菜单表
    //功能关联表查询功能表
    @GetMapping("/sys-function-t/getFunctionId/{functionId}")
    public SysFunctionT getFunctionId(@PathVariable int functionId);

    @ApiOperation("功能ID不查询")
    @GetMapping("/sys-function-t/getFunIsNot/{notList}")
    public List<SysFunctionT> getFunIsNot(@PathVariable ArrayList<Integer> notList );

    //角色可能存在多个功能
    //角色表ID查询 角色关系表信息
    @GetMapping("/sys-role-function-t/getRoleFunctionId/{roleId}")
    public List<SysRoleFunctionT> getRoleFunctionID(@PathVariable("roleId") int roleId);

    @ApiOperation("角色关联表角色ID 查询角色信息")
    @GetMapping("/sys-role-t/getRole/{roleId}")
    public SysRoleT getRole(@PathVariable int roleId);

    //获得用户角色
    @ApiOperation("管理员ID获得 角色ID")
    @GetMapping("/sys-user-role-t/userrole/{adminId}")
    public SysUserRoleT userRole(@PathVariable int adminId);

    @ApiOperation("管理员添加角色关系")
    @PostMapping("/sys-user-role-t/sysUserAddRole")
    public Boolean sysUserAddRole(@RequestBody SysUserRoleT sysUserRoleT);

    @GetMapping("/sys-role-t/roleAll")
    public List<SysRoleT> roleAll();

    @ApiOperation("按用户名查询  加分页")
    @GetMapping("/sys-role-t/rolelimit/{rolename}/{page}/{limit}")
    public List<SysRoleT> rolelimit(@PathVariable String rolename, @PathVariable int page, @PathVariable int limit);

    @ApiOperation("添加 角色权限关系")
    @PostMapping("/sys-role-function-t/roleFunAdd")
    public Boolean roleFunAdd(SysRoleFunctionT sysRoleFunctionT);

    @ApiOperation("删除 Id 角色权限关系")
    @PostMapping("/sys-role-function-t/roleFunDel")
    public Boolean roleFunDel(@RequestBody SysRoleFunctionT sysRoleFunctionT);

    @ApiOperation("查询全部权限")
    @GetMapping("/sys-role-function-t/getFunAll")
    public List<SysFunctionT> getFunAll();

    @ApiOperation("分页查询权限")
    @GetMapping("/sys-role-function-t/getLimitFun/{page}/{limit}")
    public List<SysFunctionT> getLimitFun(@PathVariable int page, @PathVariable int limit);

    @ApiOperation("权限名查询权限")
    @GetMapping("/sys-role-function-t/funname/{funname}")
    public SysFunctionT funname(@PathVariable String funname);

    @ApiOperation("权限名查询权限")
    @GetMapping("/sys-role-function-t/funurl/{funurl}")
    public SysFunctionT funurl(@PathVariable String funurl);

    @ApiOperation("添加权限")
    @PostMapping("/sys-role-function-t/funAdd")
    public Boolean funAdd(@RequestBody SysFunctionT sysFunctionT);

    @ApiOperation("按ID删除权限")
    @GetMapping("/sys-function-t/funByIdDel/{funid}")
    public Boolean funByIdDel(@PathVariable int funid);
}
